import os

path = "C:\\Users\\Administrator\\Documents\\AndroidStudio\\DeviceExplorer\\xiaomi-mi_6-6cbb023f\\mnt\\sdcard\\me.yidui\\glide_cache"
# 列出当前目录下所有的文件
files = os.listdir(path)

for filename in files:
    portion = os.path.splitext(filename)
    # 如果后缀是.txt
    if portion[1] == ".0":
        # 重新组合文件名和后缀名
        newname = portion[0] + ".png"
        print(filename)  # 打印出要更改的文件名
        # os.chdir()  # 修改工作路径

        filename = os.path.join(path, filename)
        newname = os.path.join("C:\\Users\\Administrator\\Desktop\\liwu\\yidui_img", newname)
        os.rename(filename, newname)

